package jdk8;

public class Java8DefaultMethod {
    public static void main(String[] args) {
        Car2 car = new Car2();
        car.print();
    }
}

interface Vehicle{
    default void print(){
        System.out.println("我是一辆车");
    }

    static void blowHorn(){
        System.out.println("按喇叭！！！");
    }
}

interface FourWheeler{
    default void print(){
        System.out.println("我是一辆四轮车");
    }
}

class Car2 implements Vehicle, FourWheeler{
    /**
     * 当2个父接口存在同样的方法print()的时候需要重新实现
     */
    @Override
    public void print(){
        Vehicle.super.print();
        FourWheeler.super.print();
        Vehicle.blowHorn();
        System.out.println("我是一辆汽车！");
    }
}
